<template>
	<view class="text-white">
		<view class="h-250 w-p-100 flex flex-center">
			<yLoading :size="30" v-if="info.status==0"></yLoading>
			<video :src="info.result_url" class="w-p-100 h-p-100" v-if="info.status==1"></video>
			<image :src="`${system.domain}/app/ycSora/image/error.png`" class="w-200 h-200" v-if="info.status==2">
			</image>
		</view>
		<view class=" mt-12 px-8">
			<view class="round-8 bg-black-1 px-10 py-12">
				<view class="flex flex-y-center gap-6 ">
					<text class="iconfont icon-miaoshu fw-400"></text>
					<text>描述内容</text>
				</view>
				<view class="mt-12 text-grey fs-14">
					{{info.prompt}}
				</view>
			</view>
			<!-- #ifdef MP-WEIXIN -->
			<view class="mt-20 " v-if="WEBCONFIG?.wx_ad_status.includes('wx_banner')">
				<ad :unit-id="WEBCONFIG?.wx_banner" ad-theme="white">
				</ad>
			</view>
			<!-- #endif -->

			<view class="round-8 bg-black-1 px-10 py-12 mt-12" v-if="info.image_url">
				<view class="flex flex-y-center gap-6  mb-12">
					<text class="iconfont icon-tupian fw-400"></text>
					<text>参考图片</text>
				</view>
				<image :src="info.image_url" class="w-100 h-100 round-12" @click="previewImg" mode="aspectFill"></image>
			</view>
			<view class="gradient w-p-100 text-center py-12 round-12 mt-12" @click="copy">
				一键复刻
			</view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import { computed, ref } from 'vue';
	import { $http, $page, $tool } from '@/utils';
	import yLoading from "./modules/y-loading.vue";
	const downloadPopup = ref(null)
	import system from "@/utils/system";
	const info = ref({})
	onLoad((e) => {
		getDetail(e.id)
	})
	const getDetail = (id) => {
		$http.get('Case/getDetail', { id: id }).then(res => {
			info.value = res.data
		})
	}
	const copy = () => {
		const data = JSON.stringify(info.value);
		$page.reLaunch('/pages/index/index?data=' + data)
	}
	const previewImg = () => {
		uni.previewImage({
			urls: [info.value.image_url]
		})
	}
</script>

<style>
	.text-warning {
		color: #ffb464;
	}

	.text-success {
		color: #22dc5a;
	}

	.text-error {
		color: #fd394d;
	}
</style>